package com.example.blog.srevice;

import com.example.blog.dao.UserMapper;
import com.example.blog.model.Userinfo;
import com.example.blog.model.vo.UserinfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-07-31
 * Time: 16:18
 */
@Service
public class UserService {

    //注入UserMapper
    @Resource
    private UserMapper userMapper;

    //注册用户
    public int reg(Userinfo userinfo){
        return userMapper.reg(userinfo);
    }

    //根据用户名查询用户
    public Userinfo getUserByName(String username){
        return userMapper.getUserByName(username);
    }

    //根据用户id查询用户
    public UserinfoVO getUserById(int uid){
        return userMapper.getUserById(uid);
    }

}